home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7686 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  53 lines

  1. Newsgroups: comp.lang.c++,comp.os.msdos.programmer
  2. Path: actrix.gen.nz!kheidens
  3. From: kheidens@atlantis.actrix.gen.nz (Kris Heidenstrom)
  4. Subject: Re: Timer (0x1C) Interrupt exactly 18.2 seconds?
  5. Message-ID: <Dn7qnK.4EK@actrix.gen.nz>
  6. Sender: news@actrix.gen.nz (News Administrator)
  7. Organization: Actrix - Internet Services
  8. Date: Fri, 23 Feb 1996 05:16:32 GMT
  9. References: <4givrv$cim@midland.co.nz>
  10. X-Nntp-Posting-Host: atlantis.actrix.gen.nz
  11.  
  12. In article <4givrv$cim@midland.co.nz>,
  13. Jarrod S Lowe <lowefam@igrin.co.nz> wrote:
  14. > Hi
  15. > I have a C++ Program (on DOS) in which a function is attached to the
  16. > Timer (0x1C) Interrupt.
  17. > The function has a static int to count the number of times it has been
  18. > called. Every 'x' calls, It executes another function.
  19. > 'x' is 546, which one would expect to result in the function being
  20. > called every 30 seconds. However, it is called every 29 point
  21. > something seconds. Over 5 minutes you can see it has drifted. If I had
  22. > one to 'x' (now 547) it is called every 30 point something seconds -
  23. > the same problem in reverse.
  24.  
  25. Right.  The timer tick rate is about 18.2065 ticks per second or one
  26. tick every 54.9254 ms.  The exact rate is 14318180/12/65536 ticks per
  27. second.
  28.  
  29. > This program is expected to run, continually, for YEARS - so a drift
  30. > that shows up in 5 minutes will make it unusable.
  31.  
  32. Typical accuracy for this clock is 20 to 50 ppm.  If you want any
  33. reasonable long term accuracy you will still have to synchronise
  34. your program with some external timebase.
  35.  
  36. There are tricks you can use to obtain a useful interrupt rate (though
  37. of course the basic clock frequency accuracy is dictated by hardware
  38. and cannot be improved by software alone).  This stuff is covered in
  39. detail in my Timing FAQ:
  40. ftp://ftp.coast.net/SimTel/msdos/info/pctim003.zip.
  41.  
  42. > (lowefam@igrin.co.nz)
  43.  
  44. Good luck, email me if you want more info.
  45.  
  46. Kris
  47. -- 
  48. Kris Heidenstrom    kheidens@actrix.gen.nz    Wellington, NZ
  49.    "Silly Pate - Tastes great...  Bounces high!"  - AWotM
  50.